(jquery操作session方法)(jQuery设置标签内容和属性) |
您所在的位置:网站首页 › jquery ajax 获取数据 › (jquery操作session方法)(jQuery设置标签内容和属性) |
一、jQuery操作session方法
语法: 添加数据 $.session.set(‘key’, ‘value’) 删除数据 $.session.remove(‘key’); 获取数据 $.session.get(‘key’); 清除数据 $.session.clear(); 二、jQuery设置标签内容和属性设置内容 - text()、html() 以及 val() $("#btn1").click(function(){ $("#test1").text("Hello world!"); }); $("#btn2").click(function(){ $("#test2").html("Hello world!"); }); $("#btn3").click(function(){ $("#test3").val("Dolly Duck"); });设置属性 - attr() $("button").click(function(){ $("#w3s").attr("href","http://www.w3school.com.cn/jquery"); });attr() 方法也允许您同时设置多个属性。 下面的例子演示如何同时设置 href 和 title 属性: $("button").click(function(){ $("#w3s").attr({ "href" : "http://www.w3school.com.cn/jquery", "title" : "W3School jQuery Tutorial" }); }); |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |